<?php

class Xzsdsplus_Costpriceplus_Block_Rules_Edit_Tab_Actions extends Mage_Adminhtml_Block_Widget_Form {
    
    protected function _prepareForm() {
        
        $form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('costpriceplus_actions', array('legend'=>Mage::helper('costpriceplus')->__('Actions')));
        
        $fieldset->addField('action_value', 'select', array(
            'label'     => Mage::helper('costpriceplus')->__('Action'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'action_value',
            'options'    => array(
                '' => Mage::helper('costpriceplus')->__('Select'),
                '1' => Mage::helper('costpriceplus')->__('Increase Markup'),
                '2' => Mage::helper('costpriceplus')->__('Decrease Markup'),
            ),

        ));

        $fieldset->addField('increase_decrease', 'text', array(
            'label'     => Mage::helper('costpriceplus')->__('Increase/decrease by '),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'increase_decrease',
        ));
        
        $fieldset->addField('futher_rules', 'select', array(
            'label'     => Mage::helper('costpriceplus')->__('Stop further rules processing'),
            'class'     => 'required-entry',
            'name'      => 'futher_rules',
            'options'    => array(
                '1' => Mage::helper('costpriceplus')->__('Yes'),
                '0' => Mage::helper('costpriceplus')->__('No'),
            ),
        ));
        
        if ( Mage::getSingleton('adminhtml/session')->getRuleData() ) {
            $form->setValues(Mage::getSingleton('adminhtml/session')->getRuleData());
            Mage::getSingleton('adminhtml/session')->getRuleData(null);
        } 
        else {
            $form->setValues(Mage::registry('costpriceplus_rules_data')->getData());
        }
        
        return parent::_prepareForm();
    }
}
